<template>
  <div class="base-title" :class="inline ? 'base-title--inline' : ''">
    <div class="content">
      <slot></slot>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    inline: {
      type: Boolean,
      default: false,
    },
  },

  data() {
    return {};
  },

  mounted() {},

  methods: {},
};
</script>

<style lang="scss" scoped>
.base-title {
  position: relative;
  text-align: center;
  font-size: 40rpx;
  margin-bottom: 40rpx;
  padding-bottom: 20rpx;

  &::before {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 2rpx;
    background-color: var(--color-primary);
  }

  &::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 0;
    width: 50%;
    height: 6rpx;
    transform: translateX(-50%);
    background-color: var(--color-primary);
  }

  &--inline {
    max-width: 60%;
    margin: 0 auto 40rpx;
    height: auto;
    font-size: 32rpx;

    &::before,
    &::after {
      display: none;
    }

    .content {
      position: relative;
      display: inline-block;

      &::before {
        content: "";
        position: absolute;
        top: 50%;
        left: -45rpx;
        width: 30rpx;
        height: 30rpx;
        background: url("/static/img/title_dot.png") no-repeat left top / 100%;
        transform: translateY(-50%);
      }

      &::after {
        content: "";
        position: absolute;
        top: 50%;
        right: -45rpx;
        width: 30rpx;
        height: 30rpx;
        background: url("/static/img/title_dot.png") no-repeat left top / 100%;
        transform: translateY(-50%) rotateY(180deg);
      }
    }
  }
}
</style>
